package edu.hawaii.ics414.blackjack.card;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import org.junit.Test;

/**
 * Tests the Card class.
 * 
 * @author Branden Ogata
 *
 */

public class TestCard
{
  /**
   * Tests the various methods in the Card class.
   * 
   */
  
  @Test
  public void test()
  {
    Card tenHearts = new Card(Suit.HEARTS, Rank.TEN);
    assertEquals("Ten of Hearts Suit", Suit.HEARTS, tenHearts.getSuit());
    assertEquals("Ten of Hearts Rank", Rank.TEN, tenHearts.getRank());
    assertEquals("Ace of Clubs Value", 1, (new Card(Suit.CLUBS, Rank.ACE)).getValue());
    assertEquals("Ten of Hearts Value", 10, tenHearts.getValue());
    assertEquals("Jack of Spades Value", 10, (new Card(Suit.SPADES, Rank.JACK)).getValue());
    assertEquals("Ten of Hearts toString", "10H", tenHearts.toString());
    assertTrue("Ten of Hearts equality", tenHearts.equals(new Card(Suit.HEARTS, Rank.TEN)));
    assertFalse("Ten of Hearts rank inequality", tenHearts.equals(new Card(Suit.HEARTS, Rank.ACE)));
    assertFalse("Ten of Hearts suit inequality", tenHearts.equals(new Card(Suit.CLUBS, Rank.TEN)));
    assertFalse("Ten of Hearts inequality", tenHearts.equals(new Card(Suit.DIAMONDS, Rank.FIVE)));
    assertEquals("Ten of Hearts hash code", tenHearts.hashCode(), 
                                            (new Card(Suit.HEARTS, Rank.TEN)).hashCode());
  }

}
